/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package actions;

/**
 *
 * @author Rodrigo
 */

import com.opensymphony.xwork2.ActionSupport; 
import org.apache.struts2.interceptor.*;
import org.apache.struts2.dispatcher.SessionMap;
import java.util.Map; 

public class ShowPageAction extends ActionSupport implements SessionAware{
 
    protected SessionMap session; 
    
    public void setSession(Map map){
        
        session = (SessionMap) map; 
        
    }
    
    public String execute()
    {
         if(isUserOnline())
             return SUCCESS; 
         else
             return LOGIN; 
    }
    
    protected boolean isUserOnline()
    {
       
        if(session.get("usuario")!=null) 
           return true; 
        else
            return false; 
    }
 
}
